using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using MVCWeekOne.Models;

namespace MVCWeekOne.Controllers
{
    /// <summary>
    /// 工单管理控制器
    /// </summary>
    public class WorkOrderController : Controller
    {
        private readonly IConfiguration _configuration;

        public WorkOrderController(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        /// <summary>
        /// 工单列表页面
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            // 传递API配置到前端
            ViewBag.ReadApiUrl = _configuration["ApiSettings:ReadApiUrl"];
            ViewBag.WriteApiUrl = _configuration["ApiSettings:WriteApiUrl"];
            return View();
        }

        /// <summary>
        /// 新增工单页面
        /// </summary>
        /// <returns></returns>
        public IActionResult Create()
        {
            // TODO: 实现新增工单页面
            return View();
        }

        /// <summary>
        /// 编辑工单页面
        /// </summary>
        /// <param name="id">工单ID</param>
        /// <returns></returns>
        public IActionResult Edit(int id)
        {
            // TODO: 实现编辑工单页面
            ViewBag.WorkOrderId = id;
            return View();
        }

        /// <summary>
        /// 工单详情页面
        /// </summary>
        /// <param name="id">工单ID</param>
        /// <returns></returns>
        public IActionResult Detail(int id)
        {
            // TODO: 实现工单详情页面
            ViewBag.WorkOrderId = id;
            return View();
        }
    }
}
